package com.jiepos.mpos.biz.channel.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import com.jiepos.mpos.biz.channel.service.InfChnhitchService;
import com.jiepos.mpos.common.entity.App_Inf_ChnhitchEntity;
import com.jiepos.mpos.core.controller.BaseController;
import com.jiepos.mpos.core.entity.Pagination;


/**
 * 
 * 
 * <p>标题: —— 通道套扣信息表控制器</p>
 * <p>模块: 通用平台</p>
 * <p>版权: Copyright (c) 2017 江苏杰博实信息技术有限公司
 * @ProjectName:  [mpos] 
 * @Package com.jiepos.mpos.biz.channel.controller 
 * @author 张学涛
 * @version 1.0
 * @since 2017年9月25日下午5:19:59
 * @history（历次修订内容、修订人、修订时间等）
 */
@Controller
@RequestMapping("chnhitchinf")
public class InfChnhitchController extends BaseController {
	
	@Autowired
	private InfChnhitchService infChnhitchService;
	
	
	/**
	 * 进入通道套扣信息列表页面
	 * @param request
	 * @param response
	 * @param pagination
	 * @return
	 */
	@RequestMapping("/getChnhitchInfList.do")
	public ModelAndView getChnhitchInfList(HttpServletRequest request,HttpServletResponse response,Pagination pagination){
		ModelAndView model=new ModelAndView("/module/channel/chnhitch/chnhitch_list");
		return super.getDetail(request, response, model);
	}
	
	
	/**
	 * 查询通道套扣列表信息json数据
	 * @param pagination
	 * @param ins_cd
	 * @param ins_cn_nm
	 * @param service_no
	 * @param service_name
	 * @param param_no
	 * @param param_name
	 * @return
	 */
	@RequestMapping("/getChnhitchInfListJson.do")
	public @ResponseBody Map getChnhitchInfListJson(HttpServletRequest request,Pagination pagination,String ins_cd,String ins_cn_nm,
			String service_no,String service_name,String param_no,String param_name){
		return infChnhitchService.getChnhitchInfList(request,pagination, ins_cd, ins_cn_nm, service_no, service_name, param_no, param_name);		
	}
	
	/**
	 * 进入通道套扣信息详细页面
	 * @param request
	 * @param response
	 * @param pagination
	 * @param chnhitch_uuid
	 * @return
	 */
	@RequestMapping("/getChnhitchInfDetail.do")
	public ModelAndView getChnhitchInfDetail(HttpServletRequest request, HttpServletResponse response,
			Pagination pagination,String chnhitch_uuid){
		ModelAndView model=new ModelAndView("/module/channel/chnhitch/chnhitch_detail");
		Map infChnhitch=infChnhitchService.getChnhitchInfById(chnhitch_uuid);
		model.addObject("infChnhitch", infChnhitch);		
		return super.getDetail(request, response, model);
	}
	
	/**
	 * 保存通道套扣
	 * @param request
	 * @param response
	 * @param infChnhitch
	 * @return
	 */
	@RequestMapping("/saveChnhitchInf.do")
	public ModelAndView saveChnhitchInf(HttpServletRequest request, HttpServletResponse response,App_Inf_ChnhitchEntity infChnhitch){
		infChnhitchService.saveChnhitchInf(infChnhitch, super.getLoginUser(request, response));
		Map map=super.getLoginUser(request, response);  
		return new ModelAndView(new RedirectView("getChnhitchInfList.do"), map);
	}
	
	/**
	 * 删除通道套扣
	 * @param request
	 * @param response
	 * @param chnhitch_uuids
	 * @return
	 */
	@RequestMapping("/deleteChnhitchInfByIds.do")
	public ModelAndView deleteChnhitchInfByIds(HttpServletRequest request, HttpServletResponse response,String chnhitch_uuids){
		infChnhitchService.deleteChnhitchInfByIds(chnhitch_uuids);
		Map map=super.getLoginUser(request, response);  
		return new ModelAndView(new RedirectView("getChnhitchInfList.do"), map);
	}

}
